package com.logic.modular.game.battle.panel.attribute.domain;

import com.logic.modular.game.battle.panel.skillEffect.PvpSkillEffect;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class EffectStatus {
    public Long heroId;
    public Long coreHeroId;
    public Long playerId;
    public Long skillId;
    public String skillName;
    public Long skillStarId;
    public Integer skillType;// 技能效果类型
    public Long skillEffectTypeId;// 技能效果类型id
    public Integer skillEffectTypeType;
    public String skillEffectTypeIdName;

    private Integer useNum; // 回合使用次数

    public boolean use() {
        useNum -= 1;
        return useNum >= 0;
    }

    public static EffectStatus getEffectStatus(PvpSkillEffect pvpSkillEffect, PlayerHeroAttribute sourceAttribute) {
        return EffectStatus.builder()
                .heroId(pvpSkillEffect.getSourcePlayerHeroId())
                .coreHeroId(sourceAttribute.getCoreHeroId())
                .playerId(sourceAttribute.getUid())
                .skillId(pvpSkillEffect.getSourceCoreSkillId())
                .skillName(pvpSkillEffect.getCoreSkillName())
                .skillStarId(pvpSkillEffect.getSourceCoreSkillId())
                .skillType(pvpSkillEffect.getCoreSkillTyp())
                .skillEffectTypeId(pvpSkillEffect.getCoreSkillEffectTypeId())
                .skillEffectTypeType(pvpSkillEffect.getCoreSkillEffectTypeType())
                .skillEffectTypeIdName(pvpSkillEffect.getCoreSkillEffectTypeName())
                .useNum(pvpSkillEffect.getBaseTrigger().getTriggerNum())
                .build();
    }
}
